#include <iostream>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include <list>
using namespace boost::filesystem;
using namespace std;



class File
{
	public:
		path m_filename;
		std::time_t m_lastAccessTime;
};

class Directory
{
	public:

		void debug()
		{
			for(std::list<Directory>::iterator itr = m_directory.begin(); itr != m_directory.end(); ++itr)
			{
				itr->debug();
				std::cout << "skod=" << itr->m_directoryName << std::endl;
			}
			for(std::list<File>::iterator itr = m_file.begin(); itr != m_file.end(); ++itr)
			{
				std::cout << "File=" << itr->m_filename << std::endl;
			}
		}

		std::list<File>	m_file;
		std::list<Directory> m_directory;
		
		std::time_t m_lastAccessTime;
		path m_directoryName;
};

Directory g_directory;

void show_files( const path & directory, Directory &dir ) {
	if( exists( directory ) ) {
		directory_iterator end ;
		for( directory_iterator iter(directory) ; iter != end ; ++iter )
			if ( is_directory( *iter ) ) {
				cout << iter->path().string() << " (directory)\n" ;
					Directory subDir;
					subDir.m_directoryName = iter->path();
					subDir.m_lastAccessTime = last_write_time( iter->path());
					show_files(*iter, subDir) ;
					dir.m_directory.push_back(subDir);

			} else
			{
				cout << iter->path().string() << " (file)\n" ;
				File file;
				file.m_filename = iter->path();
				file.m_lastAccessTime = last_write_time(iter->path());
				dir.m_file.push_back(file);
			}
	}
}

int main() {

	Directory dir;
	show_files( ".", dir ) ;

	dir.debug();
	sleep(1);
}
